package com.viphuli.app.tool.bean.part;

import java.util.List;

import com.google.gson.annotations.SerializedName;
import com.offroader.utils.StringUtils;
import com.viphuli.app.tool.common.Constants.UserType;

public class AccountUser {

	@SerializedName("uid")
	private String uid;

	@SerializedName("user_name")
	private String userName;

	@SerializedName("tel")
	private String tel;

	@SerializedName("portrait")
	private String portrait;

	@SerializedName("user_type")
	private int userType;

	@SerializedName("circles")
	private List<Integer> circleList;
	
	@SerializedName("bind_phone")
	private int bindPhone;
	
	@SerializedName("bind_wechat")
	private int bindWechat;
	
	@SerializedName("position")
	private int position;
	
	@SerializedName("leave")
	private String leave;

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public String getTel() {
		return tel;
	}

	public String telSecurity() {

		if (StringUtils.isNotBlank(tel) && tel.length() == 11) {
			String sTel = tel.substring(0, 3) + "****" + tel.substring(7);
			return sTel;
		}

		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getPortrait() {
		return portrait;
	}

	public void setPortrait(String portrait) {
		this.portrait = portrait;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public int getUserType() {
		return userType;
	}

	public void setUserType(int userType) {
		this.userType = userType;
	}

	public List<Integer> getCircleList() {
		return circleList;
	}

	public void setCircleList(List<Integer> circleList) {
		this.circleList = circleList;
	}
	
	public int getBindWechat() {
		return bindWechat;
	}

	public void setBindWechat(int bindWechat) {
		this.bindWechat = bindWechat;
	}
	
	public int getBindPhone() {
		return bindPhone;
	}

	public void setBindPhone(int bindPhone) {
		this.bindPhone = bindPhone;
	}
	
	public int getPosition() {
		return position;
	}

	public void setPosition(int position) {
		this.position = position;
	}
	
	public String getLeave() {
		return leave;
	}

	public void setLeave(String leave) {
		this.leave = leave;
	}

	public String userType() {

		UserType type = UserType.getType(userType);

		return type.getName();
	}

	public int circleId(){
		
		if(circleList == null||circleList.isEmpty()){
			return 0;
		}else{
			return circleList.iterator().next();
		}
	}
}
